package com.xh.audit.service.impl;


import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.xh.audit.entity.project.ProjectLaborDivision;
import com.xh.audit.mapper.ProjectLaborDivisionMapper;
import com.xh.audit.service.ProjectLaborDivisionService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 项目人员分工;项目和审计人员关联表 服务实现类
 * </p>
 *
 * @author lhl
 * @since 2023-10-19
 */
@Service
public class ProjectLaborDivisionServiceImp extends ServiceImpl<ProjectLaborDivisionMapper, ProjectLaborDivision> implements ProjectLaborDivisionService {

   /* @Override
    public R<ProjectLaborDivision> saveProjectLaborDivision(ProjectLaborDivision tosave) {
        QueryWrapper queryWrapper = QueryWrapper.create()
                .from(PROJECT_LABOR_DIVISION)
                .and(PROJECT_LABOR_DIVISION.PROJECT_ID.eq(tosave.getProjectId()))
                .and(PROJECT_LABOR_DIVISION.AUDIT_USERS_ID.eq(tosave.getAuditUsersId()))
                ;
        long count = this.count(queryWrapper);
        if (count>=1){
            return R.failed("saveProjectLaborDivision:保存失败,人员存在当前项目中");
        }
        boolean saveFlag = this.saveOrUpdate(tosave);
        if (saveFlag) {
            return R.success(this.getById(tosave.getId()));
        }
        //boolean saveFlag = projectLaborDivisionService.saveOrUpdate(tosave);
        return R.failed("saveProjectLaborDivision:保存失败");
    }*/
}
